﻿Type=StaticCode
Version=2.71
@EndOfDesignText@
'Code module
'Subs in this code module will be accessible from all modules.
Sub Process_Globals
	'These global variables will be declared once when the application starts.
	'These variables can be accessed from all modules.
	Dim GV_AppPath As String : GV_AppPath = File.DirDefaultExternal  '程序目录
	Dim GV_ConfigDBFileName As String			: GV_ConfigDBFileName = "config.db"  '配置数据库模拟过程
	
	Dim GV_SQLTool As SQL
	Dim GV_JSonTool As JSONParser
	
	Dim GV_ServerIP As String                   '远程服务器IP
	Dim GV_ServerPort As Int                    '远程服务器端口
	Dim GV_ConnTimeOut As Int    : GV_ConnTimeOut = 50000              '连接超时 时间 1000毫秒=1秒
	Dim GV_UserSession As String                'session
	Dim GV_UserCode As String
	
	Dim GV_DesTool As DesClient                '加密工具
	Dim GV_DesKey As String : GV_DesKey = "_fly2ky_"   '加密Key 8位字符
	
	Dim GV_Version As Double :  GV_Version = 0.5                          '版本号
	
	Dim GV_Login As Boolean
	
	Dim GV_JC_XM As String
	
	Dim GV_Login_KSBM As String    '登陆科室
	'Dim GV_Login_KSMC As String    '登陆科室
	
	

End Sub

Sub InitData
	If File.Exists(File.DirDefaultExternal, GV_ConfigDBFileName) = False Then
		GV_AppPath = DButils.CopyDBFromAssets(GV_ConfigDBFileName)
	End If

	GV_SQLTool.Initialize(GV_AppPath, GV_ConfigDBFileName, True)

	If File.Exists(GV_AppPath,"/Image") = False Then
		File.MakeDir(GV_AppPath,"/Image")
	End If
	
	InitData_ServerConfig
	
	GV_Login_KSBM = ""
	'GV_Login_KSMC = ""
	
	
End Sub

Sub InitData_ServerConfig
	Dim DataSetConfig As Cursor
	Dim sSql As String
	
	sSql = "SELECT SERVERIP,SERVERPORT FROM ZD_CONFIG "
	Log("SQL: " & sSql)
	DataSetConfig = GV_SQLTool.ExecQuery(sSql)
	If DataSetConfig.RowCount > 0 Then
		DataSetConfig.Position = 0
		GV_ServerIP = DataSetConfig.GetString("SERVERIP")
		GV_ServerPort = DataSetConfig.GetInt("SERVERPORT")
	End If
	DataSetConfig.Close
	
End Sub

Sub GetServerUrl As String
	Return "http://"&GV_ServerIP&":"&GV_ServerPort

End Sub